<?php
require_once 'model/Model.php';
class ModelPhoto extends Model{

    function __construct() {
        parent::connection();
    }

    //retourne un tableau mysql_fetch_array
    function getPhotos(){
        $query = "select * from sb_photos";
        $result = mysql_query($query);
        return $result;
    }

    function update($id, $title){
        $query = "update sb_photos set chemins='$title' where id=$id";
        $result = mysql_query($query);
    }

    function insert($chemin){
        $query = "insert into sb_photos (chemins) values ('$chemin')";
        mysql_query($query);
        return mysql_insert_id();
    }

    function delete($id){
        $query = "delete from sb_photos where id=$id";
        mysql_query($query);
    }
}
?>
